﻿package com.wandian.model
{
	import com.wandian.ApplicationFacade;
	import com.wandian.controller.CLZNoticeName;
	import com.wandian.data.GameData;
	import com.wandian.model.http.UserData;
	import com.wandian.model.vo.*;
	
	import org.puremvc.as3.patterns.proxy.Proxy;

    public class PrizeProxy extends Proxy
    {
        private var _facade:ApplicationFacade;
        private var _global:GameData;
        public static const NAME:String = "PrizeProxy";

        public function PrizeProxy(param1:Object = null)
        {
            this._facade = ApplicationFacade.getInstance();
            this._global = GameData.getInstance();
            super(NAME, param1);
            return;
        }

        public function requestMyPrize() : void
        {
            var _loc_1:* = new UserData();
            _loc_1.requestMyPrize(this.responseMyPrize);
            return;
        }

        private function responseMyPrize(param1:Object) : void
        {
            GameData._arrMyPrize = param1.data.arr;
            this.sendNotification(CLZNoticeName.PRIZE_MY_REWARD_1_RES, param1.data.arr);
            return;
        }

        public function requestRankPrize(param1:int) : void
        {
            var _loc_2:* = new UserData();
            _loc_2.requestRankPrize(param1, this.responseRankPrize);
            return;
        }

        private function responseRankPrize(param1:Object) : void
        {
            this.sendNotification(CLZNoticeName.PRIZE_RANK_REWARD_RES, param1.data.arr);
            return;
        }

        public function requestTopPrize(param1:int, param2:int) : void
        {
            var _loc_3:* = new UserData();
            _loc_3.requestTopPrize(param1, param2, this.responseTopPrize);
            return;
        }

        private function responseTopPrize(param1:Object) : void
        {
            if (param1.svflag == 1)
            {
                this.sendNotification(CLZNoticeName.PRIZE_TOP_REWARD_RES, param1.data.arr);
            }
            else
            {
                this.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip:GameData.tip["PRIZE_ERR"]});
            }
            return;
        }

        public function requestAccPrize(param1:int, param2:int) : void
        {
            var _loc_3:* = new UserData();
            _loc_3.requestAccPrize(param1, param2, this.responseAccPrize);
            return;
        }

        private function responseAccPrize(param1:Object) : void
        {
            if (param1.svflag == 1)
            {
                this.sendNotification(CLZNoticeName.PRIZE_ACC_REWARD_RES, param1.data.arr);
            }
            else
            {
                this.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip:GameData.tip["PRIZE_ERR"]});
            }
            return;
        }

        public function requestLoginPrize(param1:int) : void
        {
            var _loc_2:* = new UserData();
            _loc_2.requestLoginPrize(param1, this.responseLoginPrize);
            return;
        }

        private function responseLoginPrize(param1:Object) : void
        {
            var _loc_2:Array = null;
            if (param1.svflag == 1)
            {
                GameData._arrMyPrize[0][2] = 1;
                _loc_2 = param1.data.arr;
                this._global.userInfo.money = _loc_2[0];
//                JSFUN.shareLoginFunc();
                this.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip:GameData.replaceStrValue(GameData.tip["PRIZE_DRAW_SUCC"], "NUM", _loc_2[1])});
            }
            else
            {
                this.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip:GameData.tip["PRIZE_ERR"]});
            }
            return;
        }

        public function requestVIPPrize() : void
        {
            var _loc_1:* = new UserData();
            _loc_1.requestVIPPrize(this._global.userInfo.userVo.vip, this.responseVIPPrize);
            return;
        }

        private function responseVIPPrize(param1:Object) : void
        {
            if (param1.svflag == 1)
            {
                GameData._arrMyPrize[1][2] = 1;
                this._global.userInfo.money = param1.data.arr[0];
                this.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip:GameData.replaceStrValue(GameData.tip["PRIZE_DRAW_SUCC"], "NUM", param1.data.arr[1])});
            }
            else
            {
                this.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip:GameData.tip["PRIZE_ERR"]});
            }
            return;
        }

        public function requestWinNumPrize(param1:int) : void
        {
            var _loc_2:* = new UserData();
            _loc_2.requestWinNumPrize(param1, this.responseWinNumPrize);
            return;
        }

        private function responseWinNumPrize(param1:Object) : void
        {
            if (param1.svflag == 1)
            {
                GameData._arrMyPrize[2][2] = 1;
                this._global.userInfo.money = param1.data.arr[0];
                this.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip:GameData.replaceStrValue(GameData.tip["PRIZE_DRAW_SUCC"], "NUM", param1.data.arr[1])});
            }
            else
            {
                this.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip:GameData.tip["PRIZE_ERR"]});
            }
            return;
        }

        public function requestBagPrize(param1:int) : void
        {
            var _loc_2:* = new UserData();
            _loc_2.requestBagPrize(param1, this.responseBagPrize);
            return;
        }

        private function responseBagPrize(param1:Object) : void
        {
            if (param1.svflag == 1)
            {
                this._global.userInfo.money = param1.data.arr[0];
                this.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip:GameData.tip["DRAW_SUCC"]});
                this.sendNotification(CLZNoticeName.PRIZE_BAG_REWARD_RES, param1.data.arr);
            }
            else
            {
                this.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip:GameData.tip["PRIZE_ERR"]});
            }
            return;
        }

        public function requestSGJ_ZP_Prize(param1:int) : void
        {
            var _loc_2:* = new UserData();
            _loc_2.requestSGJ_ZP_Prize(param1, this.responseSGJ_ZP_Prize);
            return;
        }

        private function responseSGJ_ZP_Prize(param1:Object) : void
        {
            if (param1.svflag == 1)
            {
                this.sendNotification(CLZNoticeName.SGJ_ZP_RES, param1.data.arr);
            }
            return;
        }

        public function requestSGJ_ZP_Rank(param1:int) : void
        {
            var _loc_2:* = new UserData();
            _loc_2.requestSGJ_ZP_Rank(param1, this.responseSGJ_ZP_Rank);
            return;
        }

        private function responseSGJ_ZP_Rank(param1:Object) : void
        {
            if (param1.svflag == 1)
            {
                this.sendNotification(CLZNoticeName.SGJ_ZP_RANK_RES, param1.data.arr);
            }
            return;
        }

        public function requestInitPayBag() : void
        {
            var _loc_1:* = new UserData();
            _loc_1.requestInitPayBag(this.responseInitPayBag);
            return;
        }

        private function responseInitPayBag(param1:Object) : void
        {
            if (param1.svflag == 1)
            {
                this.sendNotification(CLZNoticeName.INIT_PAY_BAG_RES, param1.data);
            }
            return;
        }

        public function requestDrawPayBag(param1:int) : void
        {
            var _loc_2:* = new UserData();
            _loc_2.requestDrawPayBag(param1, this.responseDrawPayBag);
            return;
        }

        private function responseDrawPayBag(param1:Object) : void
        {
            if (param1.svflag == 1)
            {
                this.sendNotification(CLZNoticeName.DRAW_PAY_BAG_RES, param1.data.arr);
                this._global.userInfo.money = param1.data.arr[0];
                facade.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip:GameData.tip["DRAW_SUCC"]});
//                JSFUN.sharePayBagFunc();
            }
            return;
        }

        public function requestWeibo(param1:int) : void
        {
            var _loc_2:* = new UserData();
            _loc_2.requestWeibo(param1, this.responseWeibo);
            return;
        }

        private function responseWeibo(param1:Object) : void
        {
            if (param1.svflag == 1)
            {
                this.sendNotification(CLZNoticeName.DRAW_PAY_BAG_RES, param1.data.arr);
                this._global.userInfo.money = param1.data.arr[0];
                facade.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip:GameData.replaceStrValue(GameData.tip["WEI_BO_SUCC"], "NUM", param1.data.arr[1])});
            }
            else
            {
                facade.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip:GameData.tip["WEI_BO_ERR"]});
            }
            return;
        }

        public function requestRed(param1:String) : void
        {
            var _loc_2:* = new UserData();
            _loc_2.requestRed(param1, this.responseRed);
            return;
        }

        private function responseRed(param1:Object) : void
        {
            if (param1.svflag == 1)
            {
//                JSFUN.shareRedFunc();
                this._global.userInfo.money = param1.data.arr[0];
                facade.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip:GameData.replaceStrValue(GameData.tip["DRAW_GOLD_SUCC"], "NUM", param1.data.arr[1])});
            }
            else if (param1.svflag == 1005)
            {
                facade.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip:GameData.tip["ENTER_RED_NUMBER_ERR_1"]});
            }
            else
            {
                facade.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip:GameData.tip["ENTER_RED_NUMBER_ERR_2"]});
            }
            return;
        }

        public function requestDrawNational(param1:int) : void
        {
            var _loc_2:* = new UserData();
            _loc_2.requestDrawNational(param1, this.responseDrawNational);
            return;
        }

        private function responseDrawNational(param1:Object) : void
        {
            if (param1.svflag == 1)
            {
                this._global.userInfo.money = param1.data.arr[0];
                facade.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip:GameData.replaceStrValue(GameData.tip["DRAW_GOLD_SUCC"], "NUM", param1.data.arr[1])});
            }
            return;
        }

        public function requestNational() : void
        {
            var _loc_1:* = new UserData();
            _loc_1.requestNational(this.responseNational);
            return;
        }

        private function responseNational(param1:Object) : void
        {
            if (param1.svflag == 1)
            {
                facade.sendNotification(CLZNoticeName.SHOW_NATIONAL_DAY, param1.data.arr);
            }
            return;
        }

    }
}
